//
//  Utility.m
//  YuchBox
//
//  Created by Ivan on 11-10-17.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "Utility.h"

@implementation Utility

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }
    
    return self;
}


+ (NSUInteger)getJavaStringHashCode:(NSString *)string
{
    NSUInteger h = 0;
    NSInteger off = 0;
    NSInteger len = [string length];
    
    const char *stringUTF8 = [string UTF8String];
    for (int i = 0 ; i < len ; i++) {
        h = h*31 + stringUTF8[off++];
    }
    
    return h;
}


#pragma mark - 
#pragma For UI controll
+ (void)hideView:(UIView *)view atTag:(NSInteger)tag isHidden:(BOOL)isHidden
{
    UIView *subView = [view viewWithTag:tag];
    if (nil != subView) {
        subView.hidden = isHidden;
    }
}
@end
